package server;

import network.NetQProxy;
import packet.Command;

/**
 * Node to hold client data in the lobby
 * @author Joel Garboden
 */
public class LobbyNode
{
  NetQProxy proxy;

  private String lobbyName;

  /**
   * Constructor
   * @param proxy player proxy to attach to this node
   */
  public LobbyNode(NetQProxy proxy)
  {
    this.proxy = proxy;
  }

  /**
   * Adds a command to the outgoing queue
   * @param cmd command to be sent
   */
  public void send(Command cmd)
  {
    proxy.queue.add(cmd);
  }

  /**
   * Mutator<br/>
   * @param active activity state
   */
  public void setActive(boolean active)
  {
    proxy.setActive(active);
  }

  /**
   * Accessor<br/>
   * @return whether proxy is active or not
   */
  public boolean isActive()
  {
    return proxy.isActive();
  }

  /**
   * Accessor
   * @param name client's lobby name to be set
   */
  public void setName(String name)
  {
    lobbyName = name;
  }

  /**
   * Accessor
   * @return player's lobby name
   */
  public String getName()
  {
    return lobbyName;
  }
}
